<template>
  <div class="profile-container">
    <!-- 头部信息 -->
    <div class="profile-header">
      <div class="profile-top">
        <div class="user-info">
          <div class="avatar">
            <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='40' fill='%234CD964'/%3E%3C/svg%3E" alt="头像" />
          </div>
          <div class="user-details">
            <h3>StarYun</h3>
            <div class="family-manage" @click="showUpgradeMessage">
              家庭管理(2人管理中) <van-icon name="arrow-right" size="12" />
            </div>
          </div>
        </div>
      </div>
      
      <div class="id-card" @click="showUpgradeMessage">
        <div class="id-info">
          <span class="id-name">王*柯（本人）</span>
          <span class="id-number">登记号：2015****10</span>
        </div>
        <van-icon name="qrcode" size="40" />
      </div>
    </div>
    
    <!-- 诊疗记录 -->
    <div class="section">
      <h4 class="section-title">诊疗记录</h4>
      <div class="record-grid">
        <van-grid :column-num="4">
          <van-grid-item @click="showUpgradeMessage">
            <div class="record-item">
              <van-icon name="ticket-o" size="24" />
              <span>挂号订单</span>
            </div>
          </van-grid-item>
          <van-grid-item @click="showUpgradeMessage">
            <div class="record-item">
              <van-icon name="shopping-cart-o" size="24" />
              <span>医嘱订单</span>
            </div>
          </van-grid-item>
          <van-grid-item @click="showUpgradeMessage">
            <div class="record-item">
              <van-icon name="calendar-o" size="24" />
              <span>就诊记录</span>
            </div>
          </van-grid-item>
          <van-grid-item @click="showUpgradeMessage">
            <div class="record-item">
              <van-icon name="document-text-o" size="24" />
              <span>门诊病历</span>
            </div>
          </van-grid-item>
        </van-grid>
      </div>
    </div>
    
    <!-- 服务设置 -->
    <div class="section">
      <h4 class="section-title">服务设置</h4>
      <div class="menu-list">
        <div class="menu-item" @click="showUpgradeMessage">
          <span>我的关注</span>
          <van-icon name="arrow-right" size="16" />
        </div>
        <div class="menu-item" @click="showUpgradeMessage">
          <span>地址管理</span>
          <van-icon name="arrow-right" size="16" />
        </div>
        <div class="menu-item" @click="showUpgradeMessage">
          <span>意见反馈</span>
          <van-icon name="arrow-right" size="16" />
        </div>
        <div class="menu-item" @click="showUpgradeMessage">
          <span>帮助中心</span>
          <van-icon name="arrow-right" size="16" />
        </div>
      </div>
    </div>
    
    <!-- 其他 -->
    <div class="section">
      <div class="menu-list">
        <div class="menu-item" @click="showUpgradeMessage">
          <span>信用守约</span>
          <van-icon name="arrow-right" size="16" />
        </div>
        <div class="menu-item" @click="showUpgradeMessage">
          <span>关于我们</span>
          <van-icon name="arrow-right" size="16" />
        </div>
        <div class="menu-item" @click="showUpgradeMessage">
          <span>设置</span>
          <van-icon name="arrow-right" size="16" />
        </div>
      </div>
    </div>
    
    <!-- 底部导航 -->
    <van-tabbar route v-model="active">
      <van-tabbar-item icon="home-o" to="/home">诊疗首页</van-tabbar-item>
      <van-tabbar-item icon="cloud-o" to="/website" @click="showUpgradeMessage">微官网</van-tabbar-item>
      <van-tabbar-item icon="chat-o" to="/messages" @click="showUpgradeMessage">消息中心</van-tabbar-item>
      <van-tabbar-item icon="user-o" to="/profile">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { showDialog } from 'vant'

const active = ref(3)

// 显示升级提示
const showUpgradeMessage = () => {
  showDialog({
    message: '该功能请联系管理员进行升级',
    confirmButtonText: '确定',
    showCancelButton: false
  })
}
</script>

<style scoped>
.profile-container {
  padding-bottom: 60px;
  min-height: 100vh;
  background-color: #f5f5f5;
}

.profile-header {
  background-color: #fff;
  padding: 20px 15px;
  margin-bottom: 15px;
}

.profile-top {
  margin-bottom: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.avatar img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

.user-details h3 {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 5px;
}

.family-manage {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: #666;
}

.id-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  background-color: #e6f7ff;
  border-radius: 8px;
  color: #007aff;
}

.id-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.id-name {
  font-size: 16px;
  font-weight: bold;
}

.id-number {
  font-size: 14px;
}

.section {
  background-color: #fff;
  margin-bottom: 15px;
  padding: 0 15px;
}

.section-title {
  font-size: 16px;
  font-weight: bold;
  padding: 15px 0;
  margin: 0;
}

.record-grid {
  padding-bottom: 15px;
}

.record-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.record-item span {
  font-size: 12px;
  color: #666;
}

.menu-list {
  padding: 5px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 1px solid #f0f0f0;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item span {
  font-size: 14px;
  color: #333;
}
</style>